import { GSprite } from "../../../../../com/mui/controls/GSprite";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Language } from "../../../../../extend/language/Language";
import { GlobalSkin } from "../../../../component/skin/GlobalSkin";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class InterFloCharmReward
    
    export  class InterFloCharmReward extends GSprite
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._charmValueBmp = ObjCreate.createBitmap(null, 0, 2, this);
            this._charmBg = ObjCreate.createBitmap(null, 123, 0, this);
            this._leftBg = ObjCreate.createBitmap(null, 0, 30, this);
            this._rightBg = ObjCreate.createBitmap(null, 105, 30, this);
            this._charmValueTxt = ObjCreate.createGTextField("0", 140, 4, 65, 20, this, GlobalStyle.getTextFormatCenter(GlobalStyle.textFormat6));
            this._charmTxt = ObjCreate.createGTextField(Language.getString(36291), 10, 38, 100, 20, this, GlobalStyle.textFormat6);
            this._rewardTxt = ObjCreate.createGTextField(Language.getString(36292), 120, 38, 100, 20, this, GlobalStyle.textFormat6);
            this._charmBtn = ObjCreate.createGButton(Language.getString(36293), 18, 65, 70, 25, this, GlobalSkin.ButtonRed);
            this._charmBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCharmBtnClickHandler);
            this._rewardBtn = ObjCreate.createGButton(Language.getString(36293), 125, 65, 70, 25, this, GlobalSkin.ButtonRed);
            this._rewardBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onRewardBtnClickHandler);
            LoaderHelp.addResCallBack(ResFileConst.InterFlowerRank, this.onResLoaded);
            return;
        }

        /* internal  */onResLoaded(): void
        {
            this._charmValueBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.CharmValue);
            this._charmBg.bitmapData = GlobalClass.getBitmapData(ImagesConst.FlowerNumBottom);
            this._leftBg.bitmapData = GlobalClass.getBitmapData(ImagesConst.FlowerRankBgB);
            this._rightBg.bitmapData = GlobalClass.getBitmapData(ImagesConst.FlowerRankBgB);
            return;
        }

        /* internal  */onCharmBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            dispatchEvent(new DataEvent(EventName.CharmActiveOpenCharmReward));
            return;
        }

        /* internal  */onRewardBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            dispatchEvent(new DataEvent(EventName.CharmActiveOpenRankReward));
            return;
        }

        public udpateCharmValue(arg1: int): void
        {
            this._charmValueTxt.text = arg1 + "";
            return;
        }

        /* internal */ /* var */_charmValueBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_charmBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_leftBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rightBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_charmValueTxt: GTextFiled;

        /* internal */ /* var */_charmTxt: GTextFiled;

        /* internal */ /* var */_rewardTxt: GTextFiled;

        /* internal */ /* var */_charmBtn: GButton;

        /* internal */ /* var */_rewardBtn: GButton;
    }
